﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:vms="clr-namespace:Ezpay.UI.ViewModels"
                    xmlns:vs="clr-namespace:Ezpay.UI.Views"
                    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                    xmlns:c="clr-namespace:Ezpay.UI.Controls">
    <DataTemplate DataType="{x:Type vms:NewCustomerViewModel}">
        <vs:NewCustomerView/>
    </DataTemplate>
    <DataTemplate DataType="{x:Type vms:EditCustomerViewModel}">
        <vs:EditCustomerView/>
    </DataTemplate>
    <DataTemplate DataType="{x:Type vms:HousingAgencyViewModel}">
        <c:AutoLayoutGrid CellPadding="5">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition />
            </Grid.RowDefinitions>
            <TextBlock Text="{Binding Name}" FontSize="18" TextDecorations="Underline"/>

            <telerik:RadGridView AutoGenerateColumns="False" ItemsSource="{Binding Customers}">
                <telerik:RadGridView.Columns>
                    <telerik:GridViewColumn>
                        <telerik:GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <telerik:RadButton Content="View" Width="50" Command="{Binding ShowCommand}"/>
                            </DataTemplate>
                        </telerik:GridViewColumn.CellTemplate>
                    </telerik:GridViewColumn>
                    <telerik:GridViewDataColumn Header="First Name" DataMemberBinding="{Binding FirstName}"/>
                    <telerik:GridViewDataColumn Header="Last Name" DataMemberBinding="{Binding LastName}"/>
                    <telerik:GridViewDataColumn Header="Email" DataMemberBinding="{Binding PrimaryEmail}"/>
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>

        </c:AutoLayoutGrid>
    </DataTemplate>
    <DataTemplate DataType="{x:Type vms:CustomerViewModel}">
        <vs:CustomerView/>
    </DataTemplate>
    <DataTemplate DataType="{x:Type vms:SearchViewModel}">
        <Grid>
            <Border Name="search" BorderThickness="1" BorderBrush="#222222" CornerRadius="5" Background="White" Padding="3 2 5 2">
                <DockPanel>
                    <Image Source="/Resources/Images/magnifier_16xLG.png" Stretch="None" DockPanel.Dock="Right" Margin="5 0 0 0"/>
                    <telerik:RadWatermarkTextBox WatermarkContent="Search" Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}" BorderThickness="0" />
                </DockPanel>
            </Border>

            <Popup IsOpen="{Binding Result.HasItems, Mode=OneWay}" PlacementTarget="{Binding ElementName=search}" Placement="Bottom" Width="{Binding ActualWidth, ElementName=search}" VerticalOffset="2">
                <Border Background="White" BorderThickness="1" BorderBrush="Gray" >
                    <ItemsControl ItemsSource="{Binding Result.Items}">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Grid Margin="5">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition/>
                                    </Grid.RowDefinitions>
                                    <StackPanel Orientation="Horizontal" Margin="0 0 0 5">
                                        <Image Source="{Binding Icon}" Margin="0 0 5 0"/>
                                        <TextBlock Text="{Binding Category}" />
                                    </StackPanel>

                                    <ListBox ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}" Grid.Row="1" HorizontalContentAlignment="Stretch">
                                        <ListBox.ItemTemplate>
                                            <DataTemplate>
                                                <Border Padding="0 2">
                                                    <Border.Style>
                                                        <Style TargetType="Border">
                                                            <Style.Triggers>
                                                                <Trigger Property="IsMouseOver" Value="True">
                                                                    <Setter Property="Background" Value="LightBlue"/>
                                                                </Trigger>
                                                            </Style.Triggers>
                                                        </Style>
                                                    </Border.Style>
                                                    <TextBlock Text="{Binding Description}" Margin="21 0 0 0"/>
                                                </Border>
                                            </DataTemplate>
                                        </ListBox.ItemTemplate>
                                        <ListBox.Template>
                                            <ControlTemplate TargetType="ListBox">
                                                <ItemsPresenter/>
                                            </ControlTemplate>
                                        </ListBox.Template>
                                    </ListBox>
                                </Grid>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </Border>
            </Popup>
        </Grid>
    </DataTemplate>
    <DataTemplate DataType="{x:Type vms:NavigationViewModel}">
        <telerik:RadOutlookBar Width="200" IsMinimizable="False" ItemsSource="{Binding Menus}" IsVerticalResizerVisible="False" MinimizedAreaVisibility="Collapsed" ActiveItemsCount="3">
            <telerik:RadOutlookBar.HorizontalSplitterStyle>
                <Style TargetType="Thumb">
                    <Setter Property="Visibility" Value="Collapsed"/>
                </Style>
            </telerik:RadOutlookBar.HorizontalSplitterStyle>
            <telerik:RadOutlookBar.ContentTemplate>
                <DataTemplate>
                    <ItemsControl ItemsSource="{Binding Items}">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <telerik:RadButton Content="{Binding Content}" Command="{Binding Command}"  />
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </DataTemplate>
            </telerik:RadOutlookBar.ContentTemplate>
            <telerik:RadOutlookBar.TitleTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Title}" />
                </DataTemplate>
            </telerik:RadOutlookBar.TitleTemplate>
            <telerik:RadOutlookBar.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Title}" />
                </DataTemplate>
            </telerik:RadOutlookBar.ItemTemplate>
        </telerik:RadOutlookBar>
    </DataTemplate>
    <DataTemplate DataType="{x:Type vms:NavigationHistoryViewModel}">
        <StackPanel Orientation="Horizontal">
            <Button Style="{StaticResource ImageButton}" Command="{Binding PreviousCommand}" Margin="0 0 5 0" Tag="You can't go back from where you are right now" Uid="Go back">
                <Image Source="/Resources/Images/arrow_previous_16xLG.png"/>
            </Button>
            <Button Style="{StaticResource ImageButton}" Command="{Binding NextCommand}" Tag="You can't go forward from where you are right now" Uid="Go forward">
                <Image Source="/Resources/Images/arrow_Next_16xLG.png"/>
            </Button>
        </StackPanel>
    </DataTemplate>
    <DataTemplate DataType="{x:Type vms:AddServiceViewModel}">
        <vs:AddServiceView/>
    </DataTemplate>
</ResourceDictionary>